package net.inteidee.bean.entity;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * Oggetto embeddable che permette di eseguire il logging nella nostra applicazione 
 * @author Rino
 *
 */


@Embeddable
public class MyLogging {

	@Column(name = "created_by" , nullable = true )
	private String created_by;
	
	@Column(name = "updated_by" , nullable = true )
	private String updated_by;
	
	@Column(name = "create_time" , nullable = true )
	private long create_time;
	
	@Column(name = "update_time" , nullable = true )
	private long update_time;
	
	@Column(name = "deleted" , nullable = true )
	private boolean deleted;

	public String getCreated_by() {
		return created_by;
	}

	public void setCreated_by(String created_by) {
		this.created_by = created_by;
	}

	public String getUpdated_by() {
		return updated_by;
	}

	public void setUpdated_by(String updated_by) {
		this.updated_by = updated_by;
	}

	public long getCreate_time() {
		return create_time;
	}

	public void setCreate_time(long create_time) {
		this.create_time = create_time;
	}

	public long getUpdate_time() {
		return update_time;
	}

	public void setUpdate_time(long update_time) {
		this.update_time = update_time;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (create_time ^ (create_time >>> 32));
		result = prime * result
				+ ((created_by == null) ? 0 : created_by.hashCode());
		result = prime * result + (deleted ? 1231 : 1237);
		result = prime * result + (int) (update_time ^ (update_time >>> 32));
		result = prime * result
				+ ((updated_by == null) ? 0 : updated_by.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MyLogging other = (MyLogging) obj;
		if (create_time != other.create_time)
			return false;
		if (created_by == null) {
			if (other.created_by != null)
				return false;
		} else if (!created_by.equals(other.created_by))
			return false;
		if (deleted != other.deleted)
			return false;
		if (update_time != other.update_time)
			return false;
		if (updated_by == null) {
			if (other.updated_by != null)
				return false;
		} else if (!updated_by.equals(other.updated_by))
			return false;
		return true;
	}
	
	
	
}
